home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0008_Get Keyboard CLICK.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  830b  |  34 lines

  1. {$M $800,0,0 }   { 2K stack, no heap }
  2. { This Program caUses a click each time
  3.  a key is pressed.}
  4. Uses Crt, Dos;
  5. Var
  6.   KbdIntVec : Procedure;
  7. {$F+}
  8. Procedure Keyclick; interrupt;
  9. begin
  10.   if Port[$60] < $80 then
  11.     { Only click when key is pressed }
  12.     begin
  13.     Sound(5000);
  14.     Delay(1);
  15.     NoSound;
  16.     end;
  17.   Inline ($9C); { PUSHF -- Push flags }
  18.   { Call old ISR using saved vector }
  19.   KbdIntVec;
  20. end;
  21. {$F-}
  22. begin
  23.   { Insert ISR into keyboard chain }
  24.   GetIntVec($9,@KbdIntVec);
  25.   SetIntVec($9,Addr(Keyclick));
  26.   Keep(0); { Terminate, stay resident }
  27.   readln;
  28. end.
  29.  
  30. {
  31. Actually this works as long as you change the GETinTVEC line, where it says
  32. @@KbdIntVec, it should be only one @, odd that borland would have an example
  33. that didn't Compile. (It's a fine example, surprised myself too)
  34. }